#include <54func.h>
#include <string>
#include <iostream>
#include <alibabacloud/oss/OssClient.h>
using namespace AlibabaCloud::OSS;
using std::string;
using std::cerr;
struct OSSInfo{
    string EndPoint = "oss-cn-heyuan.aliyuncs.com";
    string AccessKeyID = "LTAI5tJwGqvuMJmGc6MRemkv";
    string AccessKeySecret = "emMK9s0MnZIvW4cS6peQyG3qfaq3Ep";
    string Bucket = "liaozs-54test";
};
int main(){
    OSSInfo info;
    // 初始化网络资源
    InitializeSdk();
    // 配置客户端的属性
    ClientConfiguration conf;
    conf.maxConnections = 30;
    conf.requestTimeoutMs = 3000;
    conf.connectTimeoutMs = 3000;
    // 创建真正的客户端
    OssClient client(info.EndPoint,info.AccessKeyID,info.AccessKeySecret,conf);
    time_t expire = time(nullptr) + 600;
    StringOutcome outcome = client.GeneratePresignedUrl(info.Bucket,"dir1/file1.txt",expire,Http::Get);
    if(outcome.isSuccess()){
        cerr << outcome.result() << "\n";
    }
    else{
        cerr << "error!\n";
    }
    // 释放网络资源
    ShutdownSdk();
    return 0;
}
